<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>发布帖子</title>
</head>
<body>
<h2>发布新帖子</h2>
<form action="${pageContext.request.contextPath}/post/publish" method="post" enctype="multipart/form-data">
    <label for="title">标题：</label>
    <input type="text" id="title" name="title" required><br><br>
    
    <label for="content">内容：</label>
    <textarea id="content" name="content" required></textarea><br><br>
    
    <label for="imageFile">上传图片：</label>
    <input type="file" id="imageFile" name="imageFile" accept="image/*"><br><br>
    
    <label for="videoFile">上传视频：</label>
    <input type="file" id="videoFile" name="videoFile" accept="video/*"><br><br>
    <label for="categoryId">选择分类：</label>
    <select id="categoryId" name="categoryId" required>
        <option value="">请选择分类</option>
        <option value="1">种植</option>
        <option value="2">养殖</option>
        <option value="3">农产品加工</option>
        <option value="4">农业政策</option>
        <!-- 根据实际需求添加更多分类 -->
    </select><br><br>
    <input type="submit" value="发布">
</form>

<!-- 添加图片预览 -->
<c:if test="${not empty post.imageUrl}">
    <h3>已上传的图片：</h3>
    <img src="${pageContext.request.contextPath}${post.imageUrl}" alt="Uploaded Image" style="max-width: 100%; height: auto;">
</c:if>


</body>
</html>